@extends('frontend.magz.index')

@section('content')
<section class="single">
    <div class="container-md">
        <div class="row">
            <div class="col-lg-4 sidebar" id="sidebar">
                @include('frontend.magz.template-parts.sidebar-left')
            </div>
            <div class="col-lg-8">
                <ol class="breadcrumb">
                    <li class="breadcrumb-item"><a href="/">{{ __('theme_magz.home') }}</a></li>
                    @if($post->terms()->category()->first())
                    <li class="breadcrumb-item active" aria-current="page">{{ $post->terms()->category()->first()->name }}</li>
                    @endif
                </ol>
                <article class="article main-article">
                    <header>
                        <h1>{{ $post->post_title }}</h1>
                        <ul class="details">
                            <li>{{ __('theme_magz.posted_on') }} {{ $post->created_at->locale(LaravelLocalization::getCurrentLocale())->isoFormat('LL') }}</li>
                            @if($post->terms()->category()->first())
                            <li>
                                <a href="{{ route('category.show', $post->terms()->category()->first()->slug) }}">
                                    {{ $post->terms()->category()->first()->name }}
                                </a>
                            </li>
                            @endif
                            <li>{{ __('theme_magz.by') }} <span>{{ $post->user->name }}</span></li>
                            <li>{{ $post->post_hits }} {{ __('theme_magz.views') }}</li>
                        </ul>
                    </header>
                    <div class="main">
                        {!! $post->post_summary !!}
                        @if(!empty($post->post_image))
                        <figure>
                            <img src="{{ asset('storage/images/' . $post->post_image) }}" alt="">
                        </figure>
                        @endif
                        {!! $post->post_content !!}
                    </div>
                    <footer>
                        <div class="col-m">
                            <ul class="tags">
                                @foreach( $tags as $tag )
                                <li><a href="{{ route('tag.show', $tag->slug) }}">{{ $tag->name }}</a></li>
                                @endforeach
                            </ul>
                        </div>
                        <div class="col-m">
                            <a href="javascript:void(0);" class="love" data-id="{{ $hashids->encode($post->id) }}"><i class="ion-android-favorite-outline"></i>
                                <div>{{ $post->like }}</div>
                            </a>
                        </div>
                    </footer>
                </article>
                <div class="sharing">
                    <div class="title"><i class="ion-android-share-alt"></i> {{ __('theme_magz.sharing_is_caring') }}</div>
                    {!! Share::page(request()->url(), $post->post_title, [], '<ul class="social">', '</ul>')
                    ->facebook()
                    ->twitter()
                    ->linkedin()
                    ->whatsapp()
                    ->telegram()!!}
                </div>
                <div class="line">
                    <div>{{ __('theme_magz.author') }}</div>
                </div>
                <div class="author">
                    <figure>
                        @if($post->user->photo)
                            @if($post->user->photo)
                                @if(Utl::checkFileDisk('avatar/'.$post->user->photo, 'public'))
                                    <img src="{{ route('author.photo', $post->user->photo) }}">
                                @else
                                    <img src="{{ asset('img/noavatar.png') }}" alt="{{ __('theme_magz.no_image') }}">
                                @endif
                            @else
                            <img src="{{ asset('img/noavatar.png') }}" alt="{{ __('theme_magz.no_image') }}">
                            @endif
                        @else
                        <img src="{{ asset('img/noavatar.png') }}" alt="{{ __('theme_magz.no_image') }}">
                        @endif
                    </figure>
                    <div class="details">
                        @if($post->user->occupation) <div class="job">{{ $post->user->occupation }}</div> @endif
                        <h5 class="name">{{ $post->user->name }}</h5>
                        <p>@if($post->user->about) {{ $post->user->about }} @endif</p>

                        @if ($post->user->socialmedia()->exists())
                        <ul class="social trp sm">
                            @foreach ( $post->user->socialmedia()->get() as $socmed )
                            <li>
                                <a href="{{ $socmed->pivot->url }}" class="{{ $socmed->slug }}" target="_blank" style="background-color: {{ $socmed->color }};color:#fff">
                                    <svg>
                                        <rect /></svg>
                                    <i class="{{ $socmed->icon }}"></i>
                                </a>
                            </li>
                            @endforeach
                        </ul>
                        @endif
                    </div>
                </div>
                @include('frontend.magz.inc._related-post')
                <div class="line thin"></div>
                @include('frontend.magz.inc._comment-disqus')
            </div>
        </div>
    </div>
</section>
@endsection
